import java.util.Random;
import java.util.Scanner;

/**
 1. 用户有5000元
 2. 用户输入大小(0-大,1-小)
 3. 生成三个1-6 的随机数作为骰子
 4. 根据点数和 判断大小
 5. 根据点数大小,和用户输入的大小进行比较,
 如果一致,用户金额+50
 如果不一致, 用户金额 -50
 6. 用户没钱了 让他退出
 7. 循环 2-6
 */
public class Question04 {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int money = 5000;
        while (money > 0) {
            System.out.println("输入点数:");
            int i = scanner.nextInt();
            System.out.println("请下注:");
            int j = scanner.nextInt();
            if (j > money) {
                System.out.println("钱不够");
                break;
            }
            int a = random.nextInt(6) + 1;
            int b = random.nextInt(6) + 1;
            int c = random.nextInt(6) + 1;
            int sum = a + b + c;
            System.out.println("a:" + a + ",b:" + b + ",c:" + c);
            System.out.println("点数是:" + sum);
            if (4 <= sum && sum <= 10 && 4 <= i && i <= 10) {
                money = money + j;
                System.out.println("赢了");
                System.out.println(money);
            } else if (11 <= sum && sum <= 17 && 11 <= i && i <= 17) {
                money = money + j;
                System.out.println("赢了");
                System.out.println(money);
            } else {
                money = money - j;
                System.out.println("输了");
                System.out.println(money);
            }

        }
        System.out.println("游戏结束");

    }

}
